<script src="../../../resources/testharness.js"></script>
<script>
// Instantiate a WASM module and make sure it works.
async function instantiateModule(url)
{
  await WebAssembly.instantiateStreaming(fetch(url)).then(
    ({module, instance}) => assert_equals(instance.exports.exported_func(), 42));
}

const url_base = 'http://127.0.0.1:8000/wasm/resources/load-wasm.php?name=';

(async function runTests() {
  await instantiateModule(url_base + 'small.wasm&cors');
  await instantiateModule(url_base + 'small.wasm&cors');
  await instantiateModule(url_base + 'large.wasm&cors');
  await instantiateModule(url_base + 'large.wasm&cors');

  window.top.postMessage('done', '*');
})();

</script>

